#include <stdio.h>
#include <memory>

class test : public std::enable_shared_from_this<test> {
public:
    test() = default;
    std::shared_ptr<test> get() { return shared_from_this(); }
};

int main(int argc, const char **argv) {
    test * t = new test();
    auto x = std::shared_ptr<test>(t);
    auto x1 = x->get();
    printf("%ld\n", x.use_count());
    auto x2 = std::shared_ptr<test>(x.get());
    printf("%ld\n", x2.use_count());

    return 0;
}
